package com.huirui.server.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huirui.server.pojo.dto.ProductDto;
import com.huirui.server.pojo.entity.Product;
import com.huirui.server.pojo.result.PageResult;
import com.huirui.server.pojo.vo.*;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author yujun
 * @description 针对表【t_product(商品主表)】的数据库操作Service
 * @createDate 2025-09-16 18:02:04
 */
public interface ProductService extends IService<Product> {

    IPage<ProductBriefInfoVo> listProductsByComprehensive(String keyword, Page<ProductBriefInfoVo> pageParam);

    IPage<ProductBriefInfoVo> listProductsBySales(String keyword, Page<ProductBriefInfoVo> pageParam);

    IPage<ProductBriefInfoVo> listProductsByTime(String keyword, Page<ProductBriefInfoVo> pageParam);

    IPage<ProductBriefInfoVo> listProductsByPrice(String keyword, String orderBy, Page<ProductBriefInfoVo> pageParam);

    ProductDetailVo getProductDetailInfoByProductId(Long id);

    List<ProductBriefInfoVo> listProductBriefInfoVoByIds(@Param("ids") List<Long> ids);

    IPage<ProductBriefInfoVo> listBestseller(Long page, Long pageSize);

    PageResult<ProductVo> getProductList(String option, Long page, Long pageSize);

    void saveProduct(@Valid ProductDto productDto);

    void deleteProductById(Long id);

    ProductEditVo productEcho(Long id);

    void updateProduct(@Valid ProductDto productDto);

    PageResult<ProductVo> searchProduct(String productName, String productCode, String status, Long categoryId, Long productType, Long page, Long pageSize);

    List<SimpleProductVo> searchBriefProductInfo(String keyword);

    List<CouponProductVo> listCouponProductInfo(List<Long> productIds);


    List<SeckillProductVo> listSeckillProductInfoByProductIds(List<Long> productIds);

    List<HotSalesRankingProductVo> getHotSalesRankingProducts(Integer id);

    PageResult<HomePageProductVo> listHomePageProduct(Long categoryId, Long page, Long pageSize);

    PageResult<ProductEchoVo> listProduct(Integer searchType, Integer sort, String keyword, Long page, Long pageSize);

    PageResult<ProductListInfoVo> listProduct(String productName, String brandName, Integer productType, Long productId, Long categoryId, Integer productStatus, Long currentPage, Long pageSize);

    ProductDetailedVo getProductDetailedVoByProductId(Long id);

    OrderItemInfoVo queryOrderPrepareInfo(@NotNull(message = "商品ID不能为空") @Positive(message = "商品ID必须为正整数") Long productId, @NotNull(message = "商品规格ID不能为空") @Positive(message = "商品规格ID必须为正整数") Long productSpecificationId);

}
